package com.qdlc.p2p.biz.adapted.impl;

import org.apache.log4j.Logger;

import com.qdlc.p2p.biz.adapted.AdaptedRechargeService;
import com.qdlc.p2p.common.core.ReturnResult;
import com.qdlc.p2p.common.util.LogFactory;
import com.qdlc.p2p.dal.dto.User;
import com.qdlc.p2p.dal.dto.UserIdentify;
import com.qdlc.p2p.dal.util.UserUtils;

public abstract class AbstractAdaptedRechargeService implements AdaptedRechargeService {

	protected static final Logger log = LogFactory.QUICK_PAY_LOGGER;
	
	@Override
	public ReturnResult rechargePreCondition(User user, double money) {
		
		UserIdentify userIdentify = UserUtils.getUserIdentify(user);
		if (userIdentify.getRealNameStatus() != 1) {
			return new ReturnResult("您还未开通第三方账户,请先开户!");
		}
		if (userIdentify.getMobilePhoneStatus() != 1) {
			return new ReturnResult("请先通过手机认证!");
		}
		
		if(money < 100){
			return new ReturnResult("充值的金额不能小于100元!");
		}
		
		return ReturnResult.SUCCESS;
		
	}

}
